// pages/moment/moment.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
      moments: [
        {
          name: "张三",
          avatar: "../../assets/images/avatar/1.png",
          description: "到此一游",
          photos: [
            "../../assets/images/moment/1.jpg",
            "../../assets/images/moment/2.jpg",
            "../../assets/images/moment/3.jpg",
            "../../assets/images/moment/4.jpg",
            "../../assets/images/moment/5.jpg",
            "../../assets/images/moment/6.jpg",
            "../../assets/images/moment/7.jpg",
          ],
          date: "2023-05-01"
        },
        {
          name: "李四",
          avatar: "../../assets/images/avatar/2.png",
          description: "湖州师范学院",
          photos: [
            "../../assets/images/moment/1.jpg",
            "../../assets/images/moment/2.jpg",
            "../../assets/images/moment/3.jpg",
            "../../assets/images/moment/4.jpg"
          ],
          date: "2023-04-22"
        }
      ]
    },
  
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
  
    },
  
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {
  
    },
  
    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
      const moment = wx.getStorageSync('moment');
      if (moment) {
        this.data.moments.unshift(moment);
        wx.setStorageSync('moment', null);
      }
      this.setData({
        moments: this.data.moments
      });
    },
  
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {
  
    },
  
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {
  
    },
  
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {
  
    },
  
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {
  
    },
  
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {
  
    },
  
    navigateToPhoto() {
      wx.navigateTo({
        url: "../../pages/moment/photo/photo"
      })
    },
  
    navigateBack() {
      wx.navigateBack();
    }
  })